package com.fire.controller;

import com.fire.domain.User;
import com.fire.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
@Controller
@RequestMapping(value = "/user",produces = "text/html;charset=UTF-8")
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping(value = "/query")
    public ModelAndView showUserList(){
        ModelAndView modelAndView = new ModelAndView();
        List<User> userList = userService.findAll();
        System.out.println(userList);
        modelAndView.addObject("userList",userList);
        modelAndView.setViewName("userList");
        return modelAndView;

    }
}
